lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

Process model.html (4347B)


      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      3 <html><head><link rel="stylesheet" href="sitewide.css"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="exporter-version" content="Evernote Mac 7.6 (457297)"/><meta name="altitude" content="-4.281962394714355"/><meta name="author" content="Alex Balgavy"/><meta name="created" content="2018-11-15 16:17:05 +0000"/><meta name="latitude" content="52.30028731088095"/><meta name="longitude" content="4.987940925431394"/><meta name="source" content="desktop.mac"/><meta name="updated" content="2018-12-14 15:34:26 +0000"/><title>Process model</title></head><body><div><div><span style="font-weight: bold;">process:</span> program in execution (amount of processes depends on the program)</div><div>it’s an abstraction that allows OS to simplify resource allocation, accounting, and limiting.</div><div><br/></div><div><span style="font-weight: bold;">process table:</span></div><div>OS maintains info on resources and internal state of every process</div><div>information in Process Table: ID (PID), User (UID), Group (GID), memory address space, hw registers, open files, signals, etc.</div><div>process control blocks:</div><div><br/></div><div style="margin-left: 40px;"><img src="Process%20model.resources/screenshot.png" height="344" width="600"/><br/></div><div style="margin-left: 40px;"><br/></div><div><span style="font-weight: bold;">concurrent processes</span></div><div>in principle, multiple processes are mutually independent (they have nothing at all in common). need explicit means to interact with each other.</div><div>the CPU gets allocated to each process in turn</div><ul><li><div>on OS level: save context of process A (program counter, registers, etc.), switch to B. to go back to process A, simply restore context.</div></li></ul><div>OS (normally) offers <span style="font-style: italic;">no timing or ordering guarantees</span></div><div><br/></div><div style="margin-left: 40px;"><img src="Process%20model.resources/49DFF9CF-E995-4151-A222-48E3331BFB4A.png" height="214" width="655"/><br/></div><div style="margin-left: 40px;"><br/></div><div><span style="font-weight: bold;">process hierarchies
      4 </span></div><div>OS creates only 1 init process (usually)</div><div>parent process can create a child process</div><div>results in a tree-like structure and process groups</div><div><br/></div><div><span style="font-weight: bold;">process management</span></div><div>fork: create new process
      5 </div><ul><li><div>child is 'private' clone of parent</div></li><li><div>shares <span style="font-style: italic;">some</span> resources with parent</div></li></ul><div>exec: execute new process image
      6 </div><ul><li><div>used in combination with fork</div></li><li><div>replaces the current command</div></li></ul><div>exit: cause voluntary process termination
      7 </div><ul><li><div>exist status returned to parent process</div></li></ul><div>kill: send signal to process (or group)
      8 </div><ul><li><div>can cause involuntary process termination</div></li></ul><div><br/></div><div><span style="font-weight: bold;">process states
      9 </span></div><div>OS allocates resources to processes</div><div>three process states:
     10 </div><ul><li><div>running: process is currently executed by CPU</div></li><li><div>blocked: process is waiting for available resources</div></li><li><div>ready: process is ready to be selected</div></li></ul><div style="margin-left: 40px;"><br/></div><div style="margin-left: 40px;"><img src="Process%20model.resources/CCF73D0A-6CC9-4590-8DFE-0D72639EC440.png" height="171" width="676"/><br/></div><div style="margin-left: 80px;"><br/></div><div>scheduler allocates/deallocates the CPU. there is no immediate transition between states because process has to wait for scheduler</div><div><br/></div><div><b>scheduler vs processes</b></div><ul><li><div>scheduler periodically switches processes</div></li><li><div>sequential processes lie on the layer above</div></li><li><div>leads to simple process organisation</div></li></ul><div/><ul><div style=""><br/></div><div style=""><img src="Process%20model.resources/38570BCC-D218-4654-AADF-B2FDA78A797C.png" height="216" width="403"/><br/></div></ul></div><div><br/></div></body></html>